import 'package:fish_redux/fish_redux.dart';
import 'package:in_app_purchase/in_app_purchase.dart';

import 'state.dart';

enum PayTeacherAction {
  onLoad,
  loaded,
  listResult,
  onReload,
  onPay,
  onPurchaseList,
  purchase,
  button,
}

class PayTeacherActionCreator {
  static Action onLoad() {
    return Action(PayTeacherAction.onLoad);
  }

  static Action loaded() {
    return Action(PayTeacherAction.loaded);
  }

  static Action listResult(List items, var pageTotal, var pageIndex) {
    return Action(PayTeacherAction.listResult, payload: {
      'items': items,
      "pageTotal": pageTotal,
      "pageIndex": pageIndex
    });
  }

  static Action onReload(callback) {
    return Action(PayTeacherAction.onReload, payload: callback);
  }

  static Action onPay(String value) {
    return Action(PayTeacherAction.onPay, payload: value);
  }

  static Action onPurchaseList(List<PurchaseDetails> purchaseDetailsList) {
    return Action(PayTeacherAction.onPurchaseList,
        payload: purchaseDetailsList);
  }

  static Action purchase(PayTeacherState paramState) {
    return Action(PayTeacherAction.purchase, payload: paramState);
  }

  static Action button(String text) {
    return Action(PayTeacherAction.button, payload: text);
  }
}
